import { Http } from '@/network/request'
import { QuestionQuery, QuestionQueryRes, TagQuery, TagQueryRes } from './data.d'

/**
 * 获取标签列表
 * @param params 查询参数
 * @returns 标签列表响应
 */
export const getTagList = async (params: TagQuery): Promise<TagQueryRes> => {
  try {
    const res = await Http.post('/codeDuckTag/list', params)
    return res.data as TagQueryRes
  } catch (err) {
    throw err
  }
}

/**
 * 获取题目列表
 * @param params 查询参数
 * @returns 题目列表响应
 */
export const getQuestionList = async (params: QuestionQuery): Promise<QuestionQueryRes> => {
  try {
    const res = await Http.post('/code-duck-question/listByQuestionCategory', params)
    return res.data as QuestionQueryRes
  } catch (err) {
    throw err
  }
}
